package com.bwie.parkdemo.adapter;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.TextView;

import com.bwie.parkdemo.R;
import com.bwie.parkdemo.mvvm.model.entity.ParkingAllEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;
/**
 * 全部车位列表适配器
 * */
public class ParkingAllAdapter extends BaseQuickAdapter<Object, BaseViewHolder> {


    public ParkingAllAdapter(int layoutResId, @Nullable List<Object> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Object item) {
        ParkingAllEntity.Values entity = (ParkingAllEntity.Values) item;
        helper.setText(R.id.parkingall_item_tv,entity.parkName);
        if (entity.parkUser == 0){
            //可选择
            helper.getView(R.id.parkingall_item_tv).setBackgroundColor(Color.parseColor("#8fdb0a"));
        }else {
            helper.getView(R.id.parkingall_item_tv).setBackgroundColor(Color.GRAY);
        }
        if (entity.leftFlag){
            helper.getView(R.id.parkingall_item_tv).setBackgroundColor(Color.WHITE);
            ((TextView)helper.getView(R.id.parkingall_item_tv)).
                    setTextColor(Color.GRAY);
        }
    }
}
